<?php
namespace app\admin\validate;

use think\Validate;

class Admin extends Validate
{
    // 验证规则
    protected
        $rule = [
        'tel' => ['require', 'regex' => '/^1[34578]\d{9}$/'],
        'email' => ['require', 'regex' => '/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/'],
        'password' => ['require', 'alphaNum', 'min' => 6, 'max' => 20],
        'repassword' => 'require|confirm:password',
        'real_name' => ['require', 'regex' => '/^[\x{4e00}-\x{9fa5}]+$/u'],
        'id_card' => ['require', 'regex' => '/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/']
    ];

    // 提示信息
    protected
        $message = [
        'tel.require' => '您的用户名不能为空哦',
        'tel.regex' => '您的用户名格式不正确哦!!',
        'email.require' => '您的邮箱不能为空哦',
        'password.require' => '请输入密码',
        'password.alphaNum' => '请输入数字或字母',
        'password.min' => '密码最少有6位哦!!',
        'password.max' => '密码最多有20位哦!!',
        'repassword.require' => '两次密码不一致请重新填写',
        'real_name.require' => '请输入真实姓名',
        'real_name.regex' => '请输入中文汉字',
        'id_card.require' => '请输入身份证号',
        'id_card.regex' => '您的身份证格式不争取,请重新输入'
    ];
}


